<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Editor Bug Test: destroy causes this.toolbar is undefined</title>
        <link rel="stylesheet" href="lib/dojo/dojo/resources/dojo.css" />
        <link rel="stylesheet" href="lib/dojo/dijit/themes/tundra/tundra.css" />
        <script type="text/javascript" src="lib/dojo/dojo/dojo.js" djconfig="parseOnLoad:true">
        </script>
        <script type="text/javascript">
            dojo.require("dijit.form.Button");
            dojo.require("dijit.Editor");
            
            dojo.declare("test.testWidget", [dijit._Widget, dijit._Templated], {
                templateString: '<div dojoAttachPoint="containerNode"><div dojoType="dijit.Editor"></div></div>',
                widgetsInTemplate: true
            });
        </script>
    </head>
    <body class='tundra'>
        <p>
        	Calling destroyRecursive() on a widget with a dijit.Editor causes the editor's toolbar to
            get destroyed so when the editor's destroy() is called, the toolbar is already destroyed.
        </p>
		<p>This <a href="Bug: http://bugs.dojotoolkit.org/ticket/8052">Bug</a> is marked as closed, but I'm still getting it.</p>
        <button dojoType="dijit.form.Button">
            <script type="dojo/method" event="onClick">
                try {
				debugger;
                dijit.byId("myWidget").destroyRecursive(true);
                } catch (e) {
                alert(e);
                }
            </script>
            Destroy it!
        </button>
        <div dojoType="test.testWidget" id="myWidget">
        </div>
    </body>
</html>
